﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-us">
<head>
    <title>首页</title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="icon" href="favicon.ico" />
    <!--jquery库-->
    <script src="js/jquery.min.js"></script>
    <!--bootstrap库-->
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <script src="js/bootstrap/bootstrap.min.js"></script>
    <!--[if lt IE 9]>
    <script src="js/bootstrap/html5shiv.min.js"></script>
    <script src="js/bootstrap/respond.min.js"></script>
    <![endif]-->
    <!--font-awesome字体库-->
    <link href="css/font-awesome.min.css" rel="stylesheet" />
    <!--页面加载进度条-->
    <link href="css/pace/dataurl.css" rel="stylesheet" />
    <script src="js/pace/pace.min.js"></script>
    <!--jquery.hammer手势插件-->
    <script src="js/jquery.hammer/hammer.min.js"></script>
    <script src="js/jquery.hammer/jquery.hammer.js"></script>
    <!--平滑滚动到顶部库-->
    <script src="js/jquery.scrolltopcontrol/scrolltopcontrol.js" type="text/javascript"></script>
    <!--主要写的jquery拓展方法-->
    <script src="js/jquery.extend.js" type="text/javascript"></script>
    <!--主要写的css代码-->
    <link href="css/default.css" rel="stylesheet" type="text/css" />
    <!-- 动画效果-->
    <link href="css/animation.css" rel="stylesheet" type="text/css" />
    <!--主要写的js代码-->
    <script src="js/default.js" type="text/javascript"></script>
 <!-- jquery-easyui里的图标样式 -->
    <link rel="stylesheet" href="add-sample/easyui/themes/icon.css">
    <!-- jquery-easyui里的样式 -->
    <link rel="stylesheet" href="add-sample/easyui/themes/bootstrap/easyui.css">
    <!-- jquery的js -->
    <script type="text/javascript" src="add-sample/easyui/jquery.min.js"></script>
    <!-- jquery-easyui自己的js -->
    <script type="text/javascript" src="add-sample/easyui/jquery.easyui.min.js"></script>

    <script src="./js/jquery.md5.js"></script>
    <!--<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>-->
    <script type="text/javascript">
        function show(obj){
            $(obj).parent().addClass("active");
            $(obj).parent().siblings("li").removeClass("active");
            var isShow=$("#couponMenu").css("display");
            if(isShow == "none"){
                $("#couponMenu").show();
                $("#couponMenu li").addClass("animationFlip");
            }else {
                $("#couponMenu li").removeClass("animationFlip");
                $("#couponMenu").fadeOut(1000);
            }
        }
    </script>
    <style>
        .headSpan{
            font-family:Arial;
            font-size:18px;
            font-weight:bold;

        }
        .maincontent {
            background: url('image/pcbg.jpg') no-repeat;
            background-position: center center;
            background-size: 100% 100%;
            overflow:scroll;
        }
        .tabs-panels,.panel,.panel-body{
            height:100%;
            overflow:hidden}
        .tabs-title{
            font-family:Arial;
            font-size:15px;
        }

        #couponMenu{
            background-color: #ef6767b3;
            background-color:rgba(239,103,103,0.7);
            display: none;
        }
        #couponMenu li{
            display: block;
            position: relative;
            padding-left: 20px;
            border: 0px;

        }
        #couponMenu li a{padding: 13px 15px;
            border-bottom: none;display: block;text-decoration: none;
        }


    </style>
</head>

<body style="overflow:hidden">
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle show pull-left" data-target="sidebar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false"
                    aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>

        </div>
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                        <i class="fa fa-user fa-fw"></i>
                        <span class="username"></span>
                        <span class="caret"></span>
                    </a>
                    <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                        <a class="dropdown-item" href="javascript:logout();">退出登录</a>
                    </div>
                </li>
            </ul>

            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a href="javascript:openDiv()">修改密码</a>
                </li>
            </ul>
        </div>
    </div>
</nav>
<div class="zhezhao" style="position: fixed;position: fixed;left:0;top:0;bottom:0;right:0;background:#000;opacity:0.5;display: none;"></div>
<div class="alertPassword" style="width: 500px;height: 400px;border: 1px solid #ddd;border-radius: 5px;position:fixed;left:50%;top:50%;transform:translate(-50%,-50%);background: #fff;display: none;">
    <h2 style="font-size: 24px;text-align: center">修改密码</h2>
    <div style="margin: 30px 0 0 30px">
        <span style="font-size: 18px">　旧密码：</span>
        <input type="password" class="beforPassWord" maxlength="16" style="border: 1px solid #ddd;border-radius: 3px;width: 180px;height: 30px;">
        <span style="color: red"  class="spanText1"></span>
    </div>
    <div style="margin: 30px 0 0 30px">
        <span style="font-size: 18px">　新密码：</span>
        <input type="password" class="passWord" maxlength="16" style="border: 1px solid #ddd;border-radius: 3px;width: 180px;height: 30px;">
        <span style="color: red" class="spanText2"></span>
    </div>
    <div style="margin: 30px 0 50px 30px">
        <span style="font-size: 18px">确认密码：</span>
        <input type="password" class="passWord2" maxlength="16" style="border: 1px solid #ddd;border-radius: 3px;width: 180px;height: 30px;">
        <span style="color: red" class="spanText3"></span>
    </div>
    <div style="width: 100%;text-align: center">
        <button class="doSubmit" style="width: 80px;height: 40px;background: #337ab7;color: #fff;border: 1px solid #337ab7;border-radius: 5px">提交</button>
        <button class="closeDiv" style="width: 80px;height: 40px;background: #337ab7;color: #fff;border: 1px solid #337ab7;border-radius: 5px;margin-left: 30px">关闭</button>
    </div>
</div>
<div class="container-fluid all">
    <div class="sidebar">
        <ul class="nav">
            <li>
                <a href="index.html">首页</a>
            </li>
            <li class="has-sub" id="couponMain">
                <a href="javascript:void (0)" onclick="show(this)">
                    <span>民生免费券</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>
            <ul id="couponMenu">
                <li>
                    <a  href="javascript:void(0)" onclick="addTabSub('免费券代申请','coupon-apply.html',this)">
                        ※&nbsp;<span>免费券代申请</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:void(0)" onclick="addTabSub('扫码枪扫码','pcqrCode.html',this)">
                        ※&nbsp;<span>扫码枪扫码</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:void(0)" onclick="addTabSub('免费券查看','coupon-show.html',this)">
                        ※&nbsp;<span>免费券查看</span>
                    </a>
                </li>
                <li>
                    <a href="javascript:void(0)" onclick="addTabSub('免费券审核','coupon-review.html',this)">
                        ※&nbsp;<span>免费券审核</span>
                    </a>
                </li>
            </ul>
            <li class="has-sub">
                <a href="javascript:void(0)" onclick="addTab('送检单','add-sample/sample-list.jsp')">
                    <span>送检单</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>

            <li class="has-sub">
                <a href="javascript:void(0)" onclick="addTab('检测结果查询','sample-report.html')">
                    <span>检测结果查询</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>

            <li class="has-sub">
                <a href="javascript:void(0)" onclick="addTab('统计报表','/csfy/report/findReportTable.do')" >
                    <span>统计报表</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>
            <li class="has-sub">
                <a href="javascript:void(0)" onclick="addTab('权限分配','power-manage.html')" >
                    <span>权限分配</span>
                    <i class="fa fa-caret-right fa-fw pull-right"></i>
                </a>
            </li>

        </ul>
    </div>
    <div class="maincontent row">
        <div id="tt" style="width:100%;height:100%;"></div>
    </div>
</div>
<a href="#top" id="goTop">
    <i class="fa fa-angle-up fa-3x"></i>
</a>
<script>
    //获取当前登录用户信息
    $(document).ready(function () {

        //显示tabs
        $('#tt').tabs({
            border : false,
            title : "选项卡",
            tabWidth:130,
            tabHeight:30,
            toolPosition:"left",
        });

        var content = '<iframe scrolling="auto" frameborder="0"  src="indexPhoto.html" style="width:100%;height:100%;"></iframe>';
        $('#tt').tabs('add',{
            title:"首页",
            content:content,
            closable:true
        });
          $.ajax({
            method: 'POST',
           url: '/csfy/intf.do',
            data: { method: 'getLoginUserInfo' },
            success: res => {
            if (res.code == 10086) {
              //window.location.href = "/csfy/index.do"
            alert("请重新登录！");
            } else {
               if (res.code == 200) {
                  $(".username").html(res.rows.userName);
               }
            }
    }
    })
    })
    var beforPassWord = "";
    var userId = "";
    //弹出修改密码窗口
    function openDiv() {
        $(".zhezhao").show();
        $(".alertPassword").show();
        $.ajax({
            method: 'POST',
            url: '/csfy/user/getUserPsw.do',
            success: res => {
            var res = JSON.parse(res);
        if (res.code == 200) {
            userId = res.rows.userId;
            beforPassWord = res.rows.userPwd;
        }
    }
    })
    }
    //关闭修改密码窗口
    $(".closeDiv").click(function () {
        $(".zhezhao").hide();
        $(".alertPassword").hide();
        $(".beforPassWord").val('');
        $(".passWord").val('');
        $(".passWord2").val('');
    })
    //失去焦点校验
    $(".beforPassWord").blur(function () {
        if($.md5($(".beforPassWord").val()).toUpperCase() != beforPassWord){
            $(".spanText1").text("旧密码输入不正确！");
        }else {
            $(".spanText1").text("");
        }
    })
    $(".passWord").blur(function () {
        if($(".passWord").val().length < 6 || $(".passWord").val().length > 16){
            $(".spanText2").text("密码长度必须为6~16位！");
        }else {
            $(".spanText2").text("");
        }
    })
    $(".passWord2").blur(function () {
        if($(".passWord").val() != $(".passWord2").val()){
            $(".spanText3").text("两次输入的新密码不一样！");
        }else {
            $(".spanText3").text("");
        }
    })
    //提交修改密码
    $(".doSubmit").click(function () {
        if($.md5($(".beforPassWord").val()).toUpperCase() != beforPassWord){
            $(".spanText1").text("旧密码输入不正确！");
            return false;
        }
        if($(".passWord").val().length < 6 || $(".passWord").val().length > 16){
            $(".spanText2").text("密码长度必须为6~16位！");
            return false;
        }
        if($(".passWord").val() != $(".passWord2").val()){
            $(".spanText3").text("两次输入的新密码不一样！");
            return false;
        }
        var postData = {
            userId:userId,
            userMd5Pwd:$(".passWord").val()
        }
        $.ajax({
            method: 'POST',
            url: '/csfy/user/updateUamsUserPsw.do',
            data: postData,
            success: res => {
            var res = JSON.parse(res);
        if (res.code == 200) {
            alert("修改密码成功！");
            logout();
        }
    }
    })
    })

    //退出登录
    function logout() {
        $.ajax({
            url: '/csfy/dologout.do',
            method: 'POST',
            success: function (res) {
                if (JSON.parse(res).code == 200) {
                    window.location.href = "/csfy/index.do"
                }
            }
        })
    }
    $(".maincontent").height($(window).height() - 50);
    $(window).resize(function(){
        $(".maincontent").height($(window).height() - 50);
    })

    sessionStorage.removeItem("sampleEditSuccess");
 //动态添加标签页
    function addTab(title, url) {
        if ($('#tt').tabs('exists', title)) {
            $('#tt').tabs('select', title);
        } else {
            var content = '<iframe scrolling="auto" id ="' + url + '" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
            $('#tt').tabs('add', {
                title: title,
                content: content,
                closable: true
            });

        }
        //判断民生免费券二级菜单是否显示
        var isCoupon=url.indexOf("coupon");
        if(isCoupon == -1){
            $("#couponMenu").hide();
        }
    }

    //二级菜单动态添加标签页
    function addTabSub(title, url,obj) {
        if ($('#tt').tabs('exists', title)) {
            $('#tt').tabs('select', title);
        } else {
            var content = '<iframe scrolling="auto" id ="' + url + '" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe>';
            $('#tt').tabs('add', {
                title: title,
                content: content,
                closable: true
            });
        }
    }
    </script>
</body>
</html>